package com.ark.cloud.java.persistence.service.impl;


import com.ark.cloud.java.persistence.entity.ExplodeEvent;
import com.ark.cloud.java.persistence.entity.Vec3D;
import com.ark.cloud.java.persistence.mapper.ExplodeEventMapper;
import com.ark.cloud.java.persistence.mapper.Vec3DMapper;
import com.ark.cloud.java.persistence.service.ExplodeEventService;
import com.ark.cloud.java.persistence.utils.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author fukun
 * @create 2021/8/31  下午5:14
 * @description
 */
@Service
public class ExplodeEventServiceImpl implements ExplodeEventService {

    @Autowired
    ExplodeEventMapper explodeEventDao;

    @Autowired
    Vec3DMapper vec3DDao;

    @Override
    public void saveExplodeEventInfo(ExplodeEvent explodeEvent) {

        //设置主键
        explodeEvent.setId(UUIDUtil.next());
        System.out.println("explodeEvent:"+explodeEvent);

        // vec_threed表插入
        Vec3D pos = explodeEvent.getPos();
//        设置主键
        pos.setId(UUIDUtil.next());
        vec3DDao.insert(pos);

        Long id = pos.getId();

        // explode_event表插入
        explodeEvent.setVectedId(id);

        explodeEventDao.saveExplodeEventInfo(explodeEvent);


    }
}
